package com.vone.ui;

import java.awt.Color;
import java.awt.Component;

import javax.swing.BorderFactory;
import javax.swing.DefaultListCellRenderer;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.ListCellRenderer;

public class MyComboBoxRenderer implements ListCellRenderer<Object> {
	
	 private DefaultListCellRenderer defaultCellRenderer = new DefaultListCellRenderer();
	 
	 public Component getListCellRendererComponent(JList<?> list, Object value,
			   int index, boolean isSelected, boolean cellHasFocus) {

			  JLabel renderer = (JLabel)defaultCellRenderer.getListCellRendererComponent(
			    list, value, index, isSelected, cellHasFocus);
			  if(isSelected){
			   renderer.setBackground(new Color(39,157,227));
			   renderer.setForeground(Color.white);
			  }else{
			   renderer.setBackground(Color.WHITE);
			   renderer.setForeground(new Color(39,157,227));
			  }
			  list.setSelectionBackground(Color.white);
			  list.setBorder(null);
			  renderer.setBorder(BorderFactory.createEmptyBorder(0, 5,0, 0));
			  renderer.setHorizontalAlignment(JLabel.LEFT);
			  return renderer;
			 }
}
